package jianzhiOffer;

public class Num60 {
    public double[] dicesProbability(int n) {
        int[][] dp = new int[12][70];
        for(int i = 1; i <= 6; i++) {
            dp[1][i] = 1;
        }
        for(int i = 2; i <= n; i++) {
            for(int j = i; j <= i * 6; j++) {
                for(int k = 1; k <= 6; k++) {
                    if(j - k <= 0) break;
                    dp[i][j] += dp[i - 1][j - k];
                }
            }
        }
        double sum = Math.pow(6,n);
        double[] arr = new double[6 * n - n + 1];
        int index = 0;
        for(int i = n; i <= 6 * n; i++) {
            arr[index++] = dp[n][i] * 1.0 / sum;
        }
        return arr;
    }
}
